﻿<Window x:Class="AzureDiagMon.Common.Views.ModalDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
        mc:Ignorable="d" Title="{Binding Title}"        
        d:DesignHeight="264" d:DesignWidth="462" 
        SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen"
        Loaded="OnWindowLoaded">

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Closing">
            <command:EventToCommand Command="{Binding WindowClosing}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
            <ContentControl x:Name="childControl" Content="{Binding ChildControl}" />
        </ScrollViewer>
        <StackPanel Grid.Row="1"  Orientation="Horizontal" FlowDirection="RightToLeft" Margin="3">
            <Button Content="Cancel" Width="70" Margin="3,0,0,0" 
                    Command="{Binding CancelCommand}" 
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />

            <Button Content="OK" Width="70" Margin="3,0,0,0"
                    Command="{Binding OkCommand}" 
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" IsDefault="True" />
        </StackPanel>
    </Grid>
</Window>
